#!/bin/bash

BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
cd $BASE_DIR || exit;

shopt -s expand_aliases
[ "$(uname)" == "Darwin" ] &&  alias date='gdate'

ENV="dev"
END_DATE=$(date -d "yesterday" +%Y-%m-%d)

start=2024-08-01
end='2025-07-01'
while ! [[ $start > $end ]]; do
    start=$(date -d "$start + 1 day" +%F)
    year_month=$(date -d  "${start}" +%Y%m)   #  yyyy-MM-dd  ==>  yyyymm
    year=$(date -d     "$start" +%Y)           #  yyyy-MM-dd  ==>  yy
    month=$(date -d "$start" +%m)          #  yyyy-MM-dd  ==> mm
    day=$(date -d "$start" +%d)            #  yyyy-MM-dd   ==> dd
    folderDate="${year_month}/${day}"
    echo "[`date`] executing  "
    mkdir -p  /opt/trx-data-importer/data/trx-data-files/gx/${folderDate}

done


